﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mono.Cecil;
using Mono.Cecil.Cil;
using CecilILRewrite;

namespace OFRewriteConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            //var module = ModuleDefinition.ReadModule(args[0]);
            var module = ModuleDefinition.ReadModule(@"C:\Projects\JCSE\ELEN7046\Code\CecilILRewrite\CecilILRewrite\MyStupidLittleConsoleApplication\bin\Debug\MyStupidLittleConsoleApplication.exe");
            
            foreach (var type in module.Types)
            {
                foreach (var method in type.Methods)
                {
                    if (!method.HasBody)
                        continue;

                    var processor = new MethodProcessor(method);
                    processor.Run();
                }
            }

            module.Write("newone.exe");
        }
    }
}
